import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable, of } from 'rxjs';
import { StorageService } from './storage.service';
@Injectable({
  providedIn: 'root'
})
export class LoginService {
  redirectUrl:string;
  constructor(public http: HttpClient,private storageService: StorageService) { }
  login({userName}): Observable <any> {
    this.storageService.setUser(userName);
    return of(userName);
  }
  isLoginIn(): boolean {
    const userName = this.storageService.getUser();
    if (userName) {
      return true;
    } else {
      return false;
    }
  }
}
